<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>ivec_distance_levenshtein</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="LIBIT Documentation"
HREF="index.html"><LINK
REL="UP"
HREF="refmanual.html"><LINK
REL="PREVIOUS"
TITLE="vec_distance_kullback_leibler"
HREF="man.vec-distance-kullback-leibler.html"><LINK
REL="NEXT"
TITLE="vec_distance_mse"
HREF="man.vec-distance-mse.html"></HEAD
><BODY
CLASS="REFENTRY"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>LIBIT Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="man.vec-distance-kullback-leibler.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="man.vec-distance-mse.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="MAN.IVEC-DISTANCE-LEVENSHTEIN"
></A
>ivec_distance_levenshtein</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN797"
></A
><H2
>Name</H2
>ivec_distance_levenshtein&nbsp;--&nbsp;Levenshtein distance between two sequences</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN800"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><P
></P
><A
NAME="AEN801"
></A
><PRE
CLASS="FUNCSYNOPSISINFO"
>#include &lt;it/distance.h&gt;
      </PRE
><P
><CODE
><CODE
CLASS="FUNCDEF"
>int ivec_distance_levenshtein</CODE
>( ivec v1, ivec v2, int cost_ins, int cost_del, int cost_sub
        );</CODE
></P
><P
></P
></DIV
></DIV
><H2
>DESCRIPTION</H2
><P
> The function <CODE
CLASS="FUNCTION"
>ivec_distance_levenshtein</CODE
> returns the Levenshtein distance (also called editing distance) between two sequences, i.e. the number of positions such that the component of <CODE
CLASS="PARAMETER"
>v1</CODE
> is not equal to the one of <CODE
CLASS="PARAMETER"
>v2</CODE
>. 
Note that the complexity of this function is proportionnal to the product of length. If the sequence are of the same order of length, this leads to a computing time which is a quadratic function of the length.   </P
><H2
>RETURN VALUE</H2
><P
>    The Levenshtein distance
   </P
><H2
>EXAMPLE</H2
><PRE
CLASS="PROGRAMLISTING"
>&#13;#include &lt;distance.h&gt;

...

ivec v1 = ivec_new_string("1 2 3");            /* v1 = [ 1 2 3 ]        */
ivec v2 = ivec_new_string("0 1 2 3");          /* v2 = [ 0 2 2 3 ]      */
/* compute the Levenshtein distance between v1 and v3 (deletion+subst. =&gt; 2) */
int distance = ivec_distance_levenshtein(v1, v3, 1, 1, 1);</PRE
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="man.vec-distance-kullback-leibler.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="man.vec-distance-mse.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>vec_distance_kullback_leibler</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="refmanual.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>vec_distance_mse</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>